load("@fbcode_macros//build_defs/lib:rust_oss.bzl", "rust_oss")
load("@fbsource//tools/build_defs:rust_binary.bzl", "rust_binary")

oncall("scm_server_infra")

rust_binary(
    name = "git_server",
    srcs = glob(["src/**/*.rs"]),
    named_deps = {
        "slog": "//common/rust/shed/tracing_slog_compat:tracing_slog_compat",
    } | ({} if rust_oss.is_oss_build() else {
        "MononokeGitRequest_ods3_types": "//eden/mononoke/facebook/ods3_schemas:MononokeGitRequest_ods3-rust",
    }),
    test_deps = ["//eden/mononoke/mononoke_macros:mononoke_macros"],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:async-stream",
        "fbsource//third-party/rust:async-trait",
        "fbsource//third-party/rust:bytes",
        "fbsource//third-party/rust:clap",
        "fbsource//third-party/rust:either",
        "fbsource//third-party/rust:flate2",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:gix-hash",
        "fbsource//third-party/rust:gix-object",
        "fbsource//third-party/rust:gix-packetline",
        "fbsource//third-party/rust:gix-transport",
        "fbsource//third-party/rust:gotham",
        "fbsource//third-party/rust:gotham_derive",
        "fbsource//third-party/rust:http",
        "fbsource//third-party/rust:hyper-0-14",
        "fbsource//third-party/rust:mime",
        "fbsource//third-party/rust:rustc-hash",
        "fbsource//third-party/rust:serde",
        "fbsource//third-party/rust:serde_json",
        "fbsource//third-party/rust:strum",
        "fbsource//third-party/rust:thiserror",
        "fbsource//third-party/rust:tokio",
        "fbsource//third-party/rust:tokio-stream",
        "fbsource//third-party/rust:tracing",
        "//common/rust/shed/cloned:cloned",
        "//common/rust/shed/fbinit:fbinit",
        "//common/rust/shed/futures_stats:futures_stats",
        "//common/rust/shed/justknobs_stub:justknobs",
        "//common/rust/shed/secure_utils:secure_utils",
        "//eden/mononoke/bonsai_git_mapping:bonsai_git_mapping",
        "//eden/mononoke/bookmarks:bookmarks",
        "//eden/mononoke/cmdlib:environment",
        "//eden/mononoke/cmdlib/caching:cmdlib_caching",
        "//eden/mononoke/cmdlib/mononoke_app:mononoke_app",
        "//eden/mononoke/cmdlib/sharding:executor_lib",
        "//eden/mononoke/cmdlib/sharding_ext:sharding_ext",
        "//eden/mononoke/common/connection_security_checker:connection_security_checker",
        "//eden/mononoke/common/metadata:metadata",
        "//eden/mononoke/common/ods_counters:ods_counters",
        "//eden/mononoke/common/scuba_ext:scuba_ext",
        "//eden/mononoke/common/topo_sort:topo_sort",
        "//eden/mononoke/edenapi_service:edenapi_service",
        "//eden/mononoke/features/repo_update_logger:repo_update_logger",
        "//eden/mononoke/git/git_env:git_env",
        "//eden/mononoke/git/git_types:git_types",
        "//eden/mononoke/git/import_direct:import_direct",
        "//eden/mononoke/git/import_tools:import_tools",
        "//eden/mononoke/git/packetline:packetline",
        "//eden/mononoke/git/packfile:packfile",
        "//eden/mononoke/git/protocol:protocol",
        "//eden/mononoke/git_source_of_truth:git_source_of_truth",
        "//eden/mononoke/gotham_ext:gotham_ext",
        "//eden/mononoke/metaconfig:metaconfig_parser",
        "//eden/mononoke/metaconfig:metaconfig_types",
        "//eden/mononoke/mononoke_api:mononoke_api",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//eden/mononoke/mononoke_repos:mononoke_repos",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/permission_checker:permission_checker",
        "//eden/mononoke/rate_limiting:rate_limiting",
        "//eden/mononoke/repo_attributes/bonsai_tag_mapping:bonsai_tag_mapping",
        "//eden/mononoke/repo_attributes/repo_blobstore:repo_blobstore",
        "//eden/mononoke/repo_attributes/repo_identity:repo_identity",
        "//eden/mononoke/repo_attributes/repo_permission_checker:repo_permission_checker",
        "//eden/mononoke/repo_authorization:repo_authorization",
        "//eden/mononoke/server/context:context",
        "//eden/scm/lib/clientinfo:clientinfo",
        "//eden/scm/lib/edenapi/types:edenapi_types",
    ] + ([] if rust_oss.is_oss_build() else [
        "fbsource//third-party/rust:lazy_static",
        "//eden/mononoke/facebook/ods3_schemas:MononokeGitRequest_ods3-rs_bindings",
    ]),
)
